#!/bin/bash

# This script copies a bunch of JSON files into browser directories.
# The JSON files tells browsers where to look for the coapp binary.
# This is not a hack, browser have dedicated directories for these JSON files.
# See: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_manifests

bin="/opt/<%= package.binary_name %>/<%= package.binary_name %>"

$bin install --system
user=$(who -m | awk '{print $1}')
runuser -l $user -c "$bin install --user"
